<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/styles.css" />
	<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl; ?>/css/jquery.mobile-1.4.2.min.css">
 	<script src="<?php echo Yii::app()->baseUrl; ?>/css/jquery-1.10.2.min.js"></script> 
<!-- 	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>  -->
<!-- 	<script type="text/javascript" src=assets/657f30dc/jquery.js"></script> -->
<!-- 	<script type="text/javascript" src=assets/657f30dc/jquery.cookie.js"></script> -->
    
	<title><?php echo CHtml::encode($this->pageTitle); ?></title>
	<?php Yii::app()->clientScript->registerCoreScript('jquery'); ?>
	<?php Yii::app()->bootstrap->register(); ?>
</head>
<body>
<?php 
	$loginform = '';	
	
	if(Yii::app()->user->isGuest) {
		$loginform = '<form id="login-form" action="/goalsmanager/index.php?" method="post" class="navbar-form pull-right">'.
		'<input name="LoginForm[username]" id="LoginForm_username" class="span2" type="text" placeholder="Usuário">'.
		'<input name="LoginForm[password]" id="LoginForm_password" class="span2" type="password" placeholder="Senha">'.
		'<input type="submit" class="btn" value="Entrar">'.
		'<a href=/goalsmanager/index.php/user/create class="btn">Registrar-se</a>'.
		'</form>';
		
	} else {
		$image = Utils::findImageUrl('default_image.jpg');
		$gear = Utils::findImageUrl('logout-icon.png');
		$loginform = '<div class="navbar-form pull-right">'.
		'<b class="color_menu" style="margin-right:10px;margin-top:4px;">'.ucwords(Yii::app()->user->name).'</b>'.
		'<image src='.$image.' style="width:28px;height:28px;border:solid 1px #378120;margin-top:4px;">'.
		'<a href="/goalsmanager/index.php/site/logout" hint="Sair"><image src='.$gear.' style="width:23px;height:23px;margin-top:4px;margin-left:10px;" class="btn" title="Sair"></a></div>';
	
	}
?> 
<?php $this->widget('TbNavbar',array(
    'items'=>array(
        array(
            'class'=>'TbMenu',
            'items'=>array(
            	array('label'=>'Usuários', 'url'=> array('user/admin'), 'visible'=>!Yii::app()->user->isGuest && $_SESSION['user']->workers[0]->post == Worker::$posts['ADMIN']),
				array('label'=>'Funcionários', 'url'=> array('/analistHasWorker/index'), 'visible'=>!Yii::app()->user->isGuest && $_SESSION['user']->workers[0]->post != Worker::$posts['WORKER']),
                array('label'=>'Período', 'url'=>array('/period/index'), 'visible'=>!Yii::app()->user->isGuest && $_SESSION['user']->workers[0]->type != Worker::$types['DEVELOPMENT']),
				array('label'=> 'Metas', 'url'=> array('/goal/index'), 'visible'=>!Yii::app()->user->isGuest),
				array('label'=>'Sobre', 'url'=>array('/site/page', 'view'=>'about')),
                array('label'=>'Contato', 'url'=>array('/site/contact')),
            ),
        ), 
		
		$loginform
						
    ),
 )); ?>

<div class="container" id="page">

	<?php if(isset($this->breadcrumbs)):?>
		<?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array(
			'links'=>$this->breadcrumbs,
			'separator' => '>',
		)); ?><!-- breadcrumbs -->
	<?php endif?>
	<?php echo $content; ?>
	
	<div class="clear"></div>
	<br/><br/>
</div><!-- page -->

	<div id="footer">
			<?php echo '<p align="center">© FPFTech - Gerenciador de Metas</p>';?>
	</div>
</body>
</html>
